package com.example.sunming;

import com.example.sunming.dao.AirportMapper;
import com.example.sunming.dao.entity.AirportDO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description:
 * @date: 2021/1/18
 * @author: sunming
 */
@RestController
@RequestMapping("page")
public class TestController {

    @Autowired
    private AirportMapper airportMapper;

    @GetMapping
    public PageInfo<AirportDO> find(BaseQuery baseQuery) {
        PageHelper.startPage(baseQuery.getPageNum(), baseQuery.getPageSize());
        List<AirportDO> airportDOS = airportMapper.findAll(baseQuery);
        PageInfo<AirportDO> pageInfo = new PageInfo<>(airportDOS);
        return pageInfo;
    }
}
